$().ready(function(){
	
	$(".model").remove();
	var bookNum = parseInt( $("#bookNum").html() );
	var str = "Search In "+bookNum+" Books";
	
	$("#keyword").mouseover( function (){
		if(this.value == "")
			$(this).attr("value", str).css({color: "#ccc" });
	}).mouseout(function(){
		if(this.value == str)
			$(this).attr("value", "").css({ color: "#c0c0c0" });
	}).click(function(){
		if(this.value == str)
			$(this).attr("value", "").css({ color: "#242424", "font-weight":"bold" });
	}).keydown(function(){
		if(this.value == str)
			$(this).attr("value", "").css({ color: "#c0c0c0" });
	});
	
	var formAction = $("#form1").attr("action");
	
	$("#previous").click(function(){
		var key =  $("#keyword").attr("value");
		$("#form1").attr("action", formAction + "&method=gotoPage&currentPage=" + (parseInt($("#pcc").html()) - 1) + "&keyword=" + key);
		$("#form1").submit();
	});
	$("#next").click(function(){
		var key =  $("#keyword").attr("value");
		$("#form1").attr("action", formAction + "&method=gotoPage&currentPage=" + (parseInt($("#pcc").html()) + 1) + "&keyword=" + key);
		$("#form1").submit();
	});

	$(".curr").click(function(event){
		var key =  $("#keyword").attr("value");
		$("#form1").attr("action", formAction + "&method=gotoPage&currentPage=" + $(this).attr("value") + "&keyword=" + key);
		$("#form1").submit();
		
	});
	
	$("#subSearch").click(function(event){
		var scID = $("#scID").val();
		$("#hiddKey").val( $("#keyword").val() );
		$("#form1").attr("action", "/u?cateID=" + scID + "&cateName=" + $.trim($("#scID option:selected").html()) + 
			"&searchFiled=" + $("#searchFiled").val() ) ;

		$("#form1").submit();
		
	});
});